﻿using Abp.Domain.Entities.Auditing;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;

namespace Akso.Entities
{
    /// <summary>
    /// 基础代码表
    /// </summary>
    [Table("Basic_Codes")]
    public class CodeEntity: FullAuditedEntity<Guid>
    {
        public const int MaxNameLength = 50;
        public const int MaxCodeKeyLength = 50;
        /// <summary>
        /// 代码名称
        /// </summary>
        [Required]//字段必填
        [MaxLength(MaxNameLength)]
        public virtual string CodeName { get; set; }
        /// <summary>
        /// 代码值
        /// </summary>
        [Required]//字段必填
        [MaxLength(MaxCodeKeyLength)]
        public virtual string CodeKey { get; set; }
        /// <summary>
        /// 序号
        /// </summary>
        public virtual int SortIndex { get; set; }
        /// <summary>
        /// 外键（代码组主键ID)
        /// </summary>
        public Guid CodeGroupID { get; set; }
        [ForeignKey("CodeGroupID")]
        public CodeGroupEntity CodeGroup { get; set; }
    }
}
